package com.codelife.one.serizlizable;

/**
 * @ClassName Test2
 * @Description TODO
 * @Date 2019/10/22 16:47
 * @Version 1.0
 **/
public class Test2 {

    public static void main(String[] args) {
        Demo2 demo1 = new Demo2();
        Student student = new Student();
        student.setName("xiaoxiao");
        student.setAge(1);

        demo1.setName("zhangsan ");
        demo1.setStudent(student);


        Demo2 demo2=null;
        try {
            demo2 = (Demo2)demo1.deepClone();
        } catch (Exception e) {
            e.printStackTrace();
        }
        demo2.getStudent().setName("dada");
        demo2.getStudent().setAge(2);

        System.out.println(demo1);
        System.out.println(demo2);
    }

}
